<?php

namespace SisesporteAdmin\Form;

use Zend\Form\Form,
    \Zend\Form\Element\Select,
    \Zend\Form\Element\File;


class ManterComissionadoForm extends Form {

    protected $em;

    public function __construct($em = NULL) {
        parent::__construct('servidor');
        $this->em  = $em;

        $this->setAttribute('method', 'post');



        $this->add(array(
                'name' => 'dtCadastro',
                'options' => array(
                        'type' => 'text',
                        'label' => 'Data de Registro:'
                ),
                'attributes' => array(
                        'id' => 'dtCadastro',
                        'class' => 'input-medium'
                )
        ));

        $this->add(array(
           'name' => 'noPessoa',
            'options' => array(
                'type' => 'text',
                'label' => 'Nome Completo*:'
            ),
            'attributes' => array(
                'id' => 'noPessoa',
                'class' => 'input-xxlarge'
            )
        ));

         $this->add(array(
           'name' => 'dtNascimento',
            'options' => array(
                'type' => 'text',
                'label' => 'Data de Nascimento*:'
            ),
            'attributes' => array(
                'id' => 'dtNascimento',
                'class' => 'input-medium'
            )
        ));

         $this->add(array(
                 'name' => 'nuCpf',
                 'options' => array(
                         'type' => 'text',
                         'label' => 'CPF*:'
                 ),
                 'attributes' => array(
                         'id' => 'CPF',
                         'class' => 'input-medium'
                 )
         ));

        $this->add(array(
            'type' => 'Zend\Form\Element\Select',
            'name' => 'sqEstadoCivil',
            'options' => array(
                'label' => 'Estado Civil*:',
                'empty_option' => '-- Selecione --',
                'value_options' => $this->getResultArray('Sisesporte\Entity\EstadoCivil'),
            ),
            'attributes' => array(
                'id' => 'sqEstadoCivil'
            )
        ));


         $this->add(array(
                 'name' => 'noTelefoneFixo',
                 'options' => array(
                         'type' => 'text',
                         'label' => 'Telefone Fixo*:'
                 ),
                 'attributes' => array(
                         'id' => 'noTelefoneFixo',
                         'class' => 'input-medium'
                 )
         ));

         $this->add(array(
                 'name' => 'noTelefoneMovel',
                 'options' => array(
                         'type' => 'text',
                         'label' => 'Telefone Móvel:'
                 ),
                 'attributes' => array(
                         'id' => 'noTelefoneMovel',
                         'class' => 'input-medium'
                 )
         ));

         $this->add(array(
                 'name' => 'noEmail',
                 'options' => array(
                         'type' => 'text',
                         'label' => 'E-mail:*'
                 ),
                 'attributes' => array(
                         'id' => 'noEmail',
                         'class' => 'input-xxlarge'
                 )
         ));

         $this->add(array(
                 'name' => 'noEmergencia',
                 'options' => array(
                         'type' => 'text',
                         'label' => 'Em caso de emergência avisar:*'
                 ),
                 'attributes' => array(
                         'id' => 'noEmergencia',
                         'class' => 'input-large'
                 )
         ));

         $this->add(array(
                 'name' => 'nuFoneEmergencia',
                 'options' => array(
                         'type' => 'text',
                         'label' => 'Telefone:*'
                 ),
                 'attributes' => array(
                         'id' => 'nuFoneEmergencia',
                         'class' => 'input-large'
                 )
         ));

        $this->add(array(
           'name' => 'cancelar',
            'type' => 'Zend\Form\Element\Submit',
            'attributes' => array(
                'value' => 'Cancelar',
                'title' => 'Cancelar',
                'class' => 'btn btn-primary pull-right'
            )
        ));

        $this->add(array(
                'name' => 'limpar',
                'type' => 'Zend\Form\Element\Submit',
                'attributes' => array(
                        'value' => 'Limpar',
                        'title' => 'Limpar',
                        'class' => 'btn btn-primary pull-right'
                )
        ));

        $this->add(array(
                'name' => 'cadastrar',
                'type' => 'Zend\Form\Element\Submit',
                'attributes' => array(
                        'value' => 'Cadastrar',
                        'title' => 'Cadastrar',
                        'class' => 'btn btn-primary pull-right'
                )
        ));
    }

    protected function getResultArray($repository) {
        $repo = $this->em->getRepository($repository);
        return $repo->fetchPairs();
    }
}